package com.ruihu.admin.constant;

import com.ruihu.admin.common.domain.BaseEnum;

import java.util.Arrays;
import java.util.Optional;

public enum TerminalTypeEnum implements BaseEnum {

    PC("pc", "PC"),

    MOBILE("mobile", "Mobile");


    private String value;

    private String desc;

    TerminalTypeEnum(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public String getValue() {
        return this.value;
    }

    @Override
    public String getDesc() {
        return this.desc;
    }

    public static TerminalTypeEnum of(String value) {
        TerminalTypeEnum[] values = TerminalTypeEnum.values();
        Optional<TerminalTypeEnum> first = Arrays.stream(values).filter(e -> e.getValue().equals(value)).findFirst();
        return !first.isPresent() ? null : first.get();
    }
}
